home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1995 May / cd Ware (Juegos) Epimundo.iso / WIN / VB_DB / PROFIT.ZIP / PRNMIX.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1993-04-07  |  6.9 KB  |  190 lines

  1. VERSION 2.00
  2. Begin Form PrnMix 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Print Profitability Report"
  5.    ControlBox      =   0   'False
  6.    Height          =   2370
  7.    Icon            =   PRNMIX.FRX:0000
  8.    Left            =   3420
  9.    LinkTopic       =   "PrnMix"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   1965
  13.    ScaleWidth      =   2925
  14.    Top             =   2325
  15.    Width           =   3045
  16.    Begin CommandButton Command1 
  17.       Caption         =   "Cancel"
  18.       Height          =   495
  19.       Left            =   840
  20.       TabIndex        =   0
  21.       Top             =   1080
  22.       Width           =   1215
  23.    End
  24. Sub Command1_Click ()
  25.   PrintCancelFlag = True
  26. End Sub
  27. Sub Form_Activate ()
  28.   Unload SalesMix
  29.   PrintRoutine
  30. End Sub
  31. Sub PrintRoutine ()
  32.     t% = DoEvents()
  33.     On Local Error GoTo ErrorRoutine
  34.     PageNo% = 0
  35.     TotalRetail& = 0
  36.     TotalCost& = 0
  37.     Printer.FontName = RTrim(CfgRec.FontName)
  38.     Printer.FontSize = CfgRec.FontSize
  39.     MaximumY& = (Printer.ScaleHeight - 1500)
  40.     PrintingCancelFlag = False
  41.     Print "Deli Menu System"
  42.     Print "Profitability Report Print"
  43.     Print "Printing...Please Wait..."
  44.    'Begin First Pass
  45.    'This pass is to get the totals before printing the report.
  46.     t% = DoEvents()
  47.     FirstSalesMix
  48.     If SalesMixSt% <> 0 Then
  49.       MsgUnknownSalesMixError
  50.     End If
  51.     Do
  52.       ExtCost& = 0
  53.       ExtRetail& = 0
  54.       RecipeCost = 0
  55.       RecipeRec.RecNo = SalesMixRec.RecNo
  56.       ReadRecipe
  57.       'Get lines of ingredients
  58.       RecipeDetRec.RecDetKey = RecipeRec.RecNo + String$(15, "0")
  59.       GetGERecipeDet
  60.       If RecipeDetSt% <> 9 And RecipeDetSt% <> 0 Then
  61.         MsgUnknownRecipeDetError
  62.         GoTo ExitProgram
  63.       End If
  64.       Do Until RecipeDetSt% <> 0 Or RecipeDetRec.RecDetKey > RecipeRec.RecNo + String$(15, "Z")
  65.           IngredientRec.IngKey = Mid$(RecipeDetRec.RecDetKey, 7, 15)
  66.           ReadIngredient
  67.           If IngredientSt% = 0 Then
  68.             PrIngred$ = Mid$(RecipeDetRec.RecDetKey, 7, 15)
  69.             PrNoUnits# = RecipeDetRec.RecDetQty
  70.             GoSub ProcessOneIngredient
  71.           End If
  72.           t% = DoEvents()
  73.           NextRecipeDet
  74.       Loop
  75.       ExtRetail& = RecipeRec.RecRetail * SalesMixRec.ServingsSold
  76.       UnitCost& = RecipeCost / RecipeRec.Servings
  77.       ExtCost& = UnitCost& * SalesMixRec.ServingsSold
  78.       TotalRetail& = TotalRetail& + ExtRetail&
  79.       TotalCost& = TotalCost& + ExtCost&
  80.       NextSalesMix
  81.       t% = DoEvents()
  82.     Loop Until SalesMixSt% <> 0 Or PrintCancelFlag = True
  83.     DollarProfit@ = (TotalRetail& - (TotalCost& / 100)) / 100
  84.    'Begin Second Pass
  85.     GoSub PrintHeading
  86.     t% = DoEvents()
  87.     FirstSalesMix
  88.     If SalesMixSt% <> 0 Then
  89.       MsgUnknownSalesMixError
  90.     End If
  91.     Do
  92.       If Printer.CurrentY > MaximumY& Then
  93.         Printer.NewPage
  94.         GoSub PrintHeading
  95.       End If
  96.       ExtCost& = 0
  97.       ExtRetail& = 0
  98.       RecipeCost = 0
  99.       RecipeRec.RecNo = SalesMixRec.RecNo
  100.       ReadRecipe
  101.       'Get lines of ingredients
  102.       RecipeDetRec.RecDetKey = RecipeRec.RecNo + String$(15, "0")
  103.       GetGERecipeDet
  104.       If RecipeDetSt% <> 9 And RecipeDetSt% <> 0 Then
  105.         MsgUnknownRecipeDetError
  106.         GoTo ExitProgram
  107.       End If
  108.       Do Until RecipeDetSt% <> 0 Or RecipeDetRec.RecDetKey > RecipeRec.RecNo + String$(15, "Z")
  109.           IngredientRec.IngKey = Mid$(RecipeDetRec.RecDetKey, 7, 15)
  110.           ReadIngredient
  111.           If IngredientSt% = 0 Then
  112.             PrIngred$ = Mid$(RecipeDetRec.RecDetKey, 7, 15)
  113.             PrNoUnits# = RecipeDetRec.RecDetQty
  114.             GoSub ProcessOneIngredient
  115.           End If
  116.           t% = DoEvents()
  117.           NextRecipeDet
  118.       Loop
  119.       Printer.Print SalesMixRec.RecNo;
  120.       Printer.Print Tab(8); RecipeRec.RecDesc;
  121.       ExtRetail& = RecipeRec.RecRetail * SalesMixRec.ServingsSold
  122.       Temp1$ = Format$((RecipeRec.RecRetail / 100), "##0.00")
  123.       Temp1$ = String$(6 - Len(Temp1$), " ") + Temp1$
  124.       Printer.Print Tab(40); Temp1$;
  125.       UnitCost& = RecipeCost / RecipeRec.Servings
  126.       ExtCost& = UnitCost& * SalesMixRec.ServingsSold
  127.       Temp1$ = Format$((UnitCost& / 10000), "##0.0000")
  128.       Temp1$ = String$(8 - Len(Temp1$), " ") + Temp1$
  129.       Printer.Print Tab(48); Temp1$;
  130.       Temp1$ = Format$(SalesMixRec.ServingsSold, "####0")
  131.       Temp1$ = String$(5 - Len(Temp1$), " ") + Temp1$
  132.       Printer.Print Tab(58); Temp1$;
  133.       Temp1$ = Format$((ExtRetail& / 100), "#####0.00")
  134.       Temp1$ = String$(9 - Len(Temp1$), " ") + Temp1$
  135.       Printer.Print Tab(65); Temp1$;
  136.       Temp1$ = Format$((ExtCost& / 10000), "#####0.0000")
  137.       Temp1$ = String$(11 - Len(Temp1$), " ") + Temp1$
  138.       Printer.Print Tab(76); Temp1$;
  139.       Temp1$ = Format$(((ExtRetail& / 100) - (ExtCost& / 10000)), "#####0.00")
  140.       Temp1$ = String$(9 - Len(Temp1$), " ") + Temp1$
  141.       Printer.Print Tab(89); Temp1$;
  142.       PctSales@ = (ExtRetail& / TotalRetail&) * 100
  143.       Temp1$ = Format$(PctSales@, "###.00")
  144.       Temp1$ = String$(6 - Len(Temp1$), " ") + Temp1$
  145.       Printer.Print Tab(100); Temp1$;
  146.       PctProfit@ = ((ExtRetail& - (ExtCost& / 100)) / (DollarProfit@ * 100)) * 100
  147.       Temp1$ = Format$(PctProfit@, "###.00")
  148.       Temp1$ = String$(6 - Len(Temp1$), " ") + Temp1$
  149.       Printer.Print Tab(108); Temp1$
  150.       NextSalesMix
  151.       t% = DoEvents()
  152.     Loop Until SalesMixSt% <> 0 Or PrintCancelFlag = True
  153.     GoSub PrintTotals
  154.     GoTo ExitProgram
  155.     Exit Sub
  156. PrintHeading:
  157.     PageNo% = PageNo% + 1
  158.     Printer.Print "Projected Sales Mix Profitability Report"; Tab(55); Date$; Tab(85); "Page "; PageNo%
  159.     Printer.Print Tab(66); "Extended     Extended     Dollar    % of    % of"
  160.     Printer.Print "Recipe# Description"; Tab(40); "Retail      Cost   Sold     Retail         Cost     Profit   Sales  Profit"
  161.     Printer.Print String$(113, "-")
  162.     Return
  163. ProcessOneIngredient:
  164.     IngredientRec.IngKey = PrIngred$
  165.     ReadIngredient
  166.     CostPerUnit& = IngredientRec.IngCaseCost / IngredientRec.IngUnitsPerCase
  167.     IngredientCost = (CostPerUnit& * PrNoUnits#)
  168.     RecipeCost = RecipeCost + IngredientCost
  169.     Return
  170. PrintTotals:
  171.     Printer.Print String$(113, "-")
  172.     PctProfit@ = ((TotalRetail& - (TotalCost& / 100)) / TotalRetail&) * 100
  173.     Printer.Print "Total menu profit percent = "; Format$(PctProfit@, "##0.00"); "%";
  174.     Temp1$ = Format$((TotalRetail& / 100), "#####0.00")
  175.     Temp1$ = String$(9 - Len(Temp1$), " ") + Temp1$
  176.     Printer.Print Tab(65); Temp1$;
  177.     Temp1$ = Format$((TotalCost& / 10000), "#####0.0000")
  178.     Temp1$ = String$(11 - Len(Temp1$), " ") + Temp1$
  179.     Printer.Print Tab(76); Temp1$;
  180.     Temp1$ = Format$(DollarProfit@, "#####0.00")
  181.     Temp1$ = String$(9 - Len(Temp1$), " ") + Temp1$
  182.     Printer.Print Tab(89); Temp1$
  183.     Return
  184. ErrorRoutine:
  185.     Resume ExitProgram
  186. ExitProgram:
  187.     Printer.EndDoc
  188.     Unload PrnMix
  189. End Sub
  190.